#pragma once

/**
 * @file LoginRequest.h
 * @brief parse LoginRequest from XML format and build LoginRequest to XML format
 * @date 2014-4-11
 * @author jelin@163.com
 */

/*
<?xml version="1.0" encoding="utf-8"?>
<Request>
	<Security ip="" date="" digitalseal=""/>
	<Service business="AAS" function="authenticate"/>
	<RequestInfo querytype="Other">
		<AuthenticateInfo uid="" password="" type=""/>
	</RequestInfo>
</Request>

*/

#include "core.h"
using namespace std;
#include <string>
//#include "XMLReqReader.h"
//#include "XMLReqWriter.h"

#include "XMLBaseProto.h"
/**
*	@brief the info of UserLogin class
*/
struct CORE_API UserLoginReq:public CommRequest
{
	string uid;
	string passwd;
	int    type;
};
/**
*	@brief parse UserLogin object from XML format
*/
class CORE_API LoginReqReader:public XMLReqReader
{
public:
	LoginReqReader(void);
	~LoginReqReader(void);
	/**
	* get UserLogin info from str
	*
	* @param[in] str xml format  of user login info from client
	* @param[out] userLogin about user,password,ip,date info
	*
	* @return 
	*	- 0 if can find all field of UserLogin 
	*	- -1 when str format error
	*/
	int read(CommRequest& userLogin);

};

/**
*	@brief build XML format by UserLogin object
*/
class LoginReqWriter: public XMLReqWriter
{
public:
	LoginReqWriter(void);
	~LoginReqWriter(void);
};

